package org.vectrics.common.view;



import java.util.*;
import org.apache.log4j.Category;

public class MenuProperties  {
    private static Category log = Category.getInstance(MenuProperties.class);

    private Vector levelProps = new Vector();

    public MenuLevelProps getLevelProps(int level) {
        while (levelProps.size() < level + 1) {
            MenuLevelProps newProps = new MenuLevelProps();
            levelProps.add(newProps);
        }
        return((MenuLevelProps)levelProps.elementAt(level));
    }

    
/* --- geometry and timing of the menu --- 
var MENU_POS_SUPPORT = new Array();
	// item sizes for different levels of menu
	MENU_POS_SUPPORT['height'] = [16, 16, 16];
	MENU_POS_SUPPORT['width'] = [90, 140, 140];

	// menu block offset from the origin:
	//	for root level origin is upper left corner of the page
	//	for other levels origin is upper left corner of parent item
	MENU_POS_SUPPORT['block_top'] = [9, 21, 0];
	MENU_POS_SUPPORT['block_left'] = [6, 0, 142];

	// offsets between items of the same level
	MENU_POS_SUPPORT['top'] = [0, 20, 20];
	MENU_POS_SUPPORT['left'] = [91, 0, 0];

	// time in milliseconds before menu is hidden after cursor has gone out
	// of any items
	MENU_POS_SUPPORT['hide_delay'] = [200, 200, 200];

/* --- dynamic menu styles -
note: you can add as many style properties as you wish but be not all browsers
are able to render them correctly. The only relatively safe properties are
'color' and 'background'.

var MENU_STYLES_SUPPORT = new Array();
	// default item state when it is visible but doesn't have mouse over
	MENU_STYLES_SUPPORT['onmouseout'] = [
		'color', ['#cccccc', '#000000', '#000000'],
		'background', ['#284279', '#cccccc', '#cccccc'],
		'fontWeight', ['normal', 'normal', 'normal'],
		'textDecoration', ['none', 'none', 'none'],
	];
	// state when item has mouse over it
	MENU_STYLES_SUPPORT['onmouseover'] = [
		'color', ['#eeeeee', '#000000', '#000000'],
		'background', ['#385289', '#d0e0f0', '#d0e0f0'],
		'fontWeight', ['normal', 'normal', 'normal'],
		'textDecoration', ['none', 'none', 'none'],
	];

	// state when mouse button has been pressed on the item
	MENU_STYLES_SUPPORT['onmousedown'] = [
		'color', ['#eeeeee', '#000000', '#000000'],
		'background', ['#385289', '#99bbcc', '#cc99ff'],
		'fontWeight', ['normal', 'normal', 'normal'],
		'textDecoration', ['none', 'none', 'none'],
	];
*/    
    
    public String getCSS() {
        StringBuffer str = new StringBuffer();
        for (int i = 0; i < levelProps.size(); i++) {
            MenuLevelProps levelProp = (MenuLevelProps)levelProps.elementAt(i);
            str.append("m0l" + i + "i {\n");
            str.append("    font-family: " + levelProp.getFontFamily() + ";\n");
            str.append("    font-size: " + levelProp.getFontSize() + ";\n");
            str.append("    text-decoration: none;\n");
            str.append("    padding: " + levelProp.getPadding() + ";\n");
            str.append("} \n");
            str.append("m0l" + i + "o {\n");
            str.append("    text-decoration: none;\n");
            str.append("    border: " + levelProp.getBorder() + ";\n");
            str.append("} \n");
                
        }
        return(str.toString());
        /*
            .m0l0i {
                font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
                font-size: 11px;
                text-decoration : none;
                padding: 1px;
            }
            .m0l0o {
                text-decoration : none;
                border : 1px solid #bbbbbb;
            }
            .m0l1i {
                font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
                font-size: 11px;
                text-decoration : none;
                padding: 2px;
            }
            .m0l1o {
                text-decoration : none;
                border : 1px solid #444444;
            }
            .m0l2i {
                font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
                font-size: 11px;
                text-decoration : none;
                padding: 2px;
            }
            .m0l2o {
                text-decoration : none;
                border : 1px solid #444444;
            }
            */
    }
    
}


